package com.study.others.printOpe;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;

import org.junit.Test;

/**
* @Name: FileCopyDemo
* @Description: 使用打印流作为输出流，改进复制文本文件
* @Author: 李超	lc_jack@foxmail.com
* @CreateDate: 2017-1-16 下午8:51:48 
* @Version: V1.0
 */
public class FileCopyDemo {
	
	/**
	* @Name: fileCopy
	* @Description: 使用打印流作为输出流，改进复制文本文件
	* @Author: 李超	lc_jack@foxmail.com
	* @Version: V1.0
	* @CreateDate: 2017-1-16 下午8:55:05
	* @Parameters: 
	* @Return: void
	 */
	@Test
	public void fileCopy() throws IOException {
		//创建高效字符读取流
		BufferedReader reader = new BufferedReader(new FileReader("FileCopyDemo.java")) ;
		//创建字符打印流
		PrintWriter writer = new PrintWriter(new FileWriter("copy.java"), true) ;
		String line = null ;
		while((line = reader.readLine()) != null) {
			writer.println(line) ;
		}
		//释放资源
		writer.close() ;
		reader.close() ;
	}

}














